import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)

const modulesFiles = require.context('./modules', true, /\.js$/)
const routeList = []
modulesFiles.keys().forEach(e => {
  const v = modulesFiles(e)
  routeList.push(v.default)
})
// const routeList = []
// modulesFiles.keys().forEach(e => {
//   const m = modulesFiles(e)
//   for (const k in m) {
//     if (k.includes('Route')) {
//       routeList.push(m[k])
//     }
//   }
// })

console.log(...routeList)
const routes = [
  ...routeList
]

const router = new VueRouter({
  mode: 'history',
  routes
})

export default router
